package sk.klimo.prototyp.client;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.TabPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

public class RightPane extends Composite {

	private InvoiceForm form;
	private InvoiceItemsTable itemsTable;
	private ReportFrame reportFrame;

	public RightPane() {
		super();
		DockPanel rootPanel = new DockPanel();

		initWidget(rootPanel);

		form = new InvoiceForm();
		itemsTable = new InvoiceItemsTable();

		reportFrame = new ReportFrame();
		reportFrame.setSize("100%", "100%");

		TabPanel tp = new TabPanel();
		VerticalPanel vertiPanel = new VerticalPanel();
		vertiPanel.add(form);
		vertiPanel.setCellHorizontalAlignment(form, DockPanel.ALIGN_CENTER);
		vertiPanel.setCellVerticalAlignment(form, DockPanel.ALIGN_MIDDLE);

		vertiPanel.add(itemsTable);
		vertiPanel.setCellHorizontalAlignment(itemsTable,
				DockPanel.ALIGN_CENTER);
		vertiPanel.setCellVerticalAlignment(itemsTable, DockPanel.ALIGN_MIDDLE);

		tp.add(vertiPanel, "Formular");
		tp.add(reportFrame, "Tlacova zostava");
		tp.setSize("100%", "100%");
		tp.getDeckPanel().setSize("100%", "95%");

		rootPanel.setSize("100%", "100%");
		rootPanel.add(tp, DockPanel.CENTER);
		rootPanel.setCellHorizontalAlignment(tp, DockPanel.ALIGN_CENTER);
		rootPanel.setCellVerticalAlignment(tp, DockPanel.ALIGN_MIDDLE);
	}

	public InvoiceForm getForm() {
		return this.form;
	}

	public InvoiceItemsTable getItemsTable() {
		return this.itemsTable;
	}

	public ReportFrame getReportFrame() {
		return reportFrame;
	}
}